#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 crane <crane@crane-pc>
#
# Distributed under terms of the MIT license.

"""

"""

class Node:
    def __init__(self, value, left=None, right=None):
        self.value = value
        self.left = left
        self.right = right

class BinaryTree:
    def __init__(self, root=None):
        self.root = root

    @classmethod
    def is_same(cls, r1, r2):
        if (r1 is None) and (r2 is None):
            return True

        if (r1 is None) or (r2 is None):
            return False

        if r1.value != r2.value:
            return False

        return cls.is_same(r1.left, r2.left) and \
               cls.is_same(r1.right, r2.right)

def test():
    l = Node(3, Node(1), Node(10))
    r = Node(8, Node(7), Node(12))
    r1 = Node(5, l, r)

    l = Node(3, Node(1), Node(10))
    r = Node(8, Node(6), Node(12))
    r2 = Node(5, l, r)

    b = BinaryTree()
    v = b.is_same(r1, r2)
    print(v)


def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
